package cc.facesign.acl.controller;

import cc.facesign.acl.bean.MenuTree;
import cc.facesign.acl.service.AclMenuService;
import cc.facesign.common.utils.bean.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private AclMenuService menuService;

    @GetMapping("/hello")
    @PreAuthorize("hasAuthority('root:exe')")
    public R hello() {
        return R.ok();
    }

    @GetMapping("test")
    public R test() {
        MenuTree tree = menuService.getMenuTreeByMenuId("1");

        return R.ok().data("data", tree);
    }
}
